{extend name="common:base"/}
{block name="css"}<link href="__CSS__/plugins/iCheck/custom.css" rel="stylesheet">
{/block}
{block name="body"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>系统</h2>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>菜单管理</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="{:\\think\\Url::build('index')}">返回</a>
                            </li>
                            <li><a href="#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-9 m-b-xs">
                            <a class="btn btn-outline btn-primary editgroup" href="{:\\think\\Url::build('AuthManager/editGroup')}">新增</a>
                            <button type="button" class="btn btn-outline btn-info ajax-post " url="{:\\think\\Url::build('batchUpdate',['value'=>1])}" target-form="ids">启用</button>
                            <button type="button" class="btn btn-outline btn-warning ajax-post confirm" url="{:\\think\\Url::build('batchUpdate',['value'=>0])}" target-form="ids" >禁用</button>
                            <button type="button" class="btn btn-outline btn-danger ajax-post confirm" url="{:\\think\\Url::build('batchUpdate',['value'=>-1])}" target-form="ids">删除</button>
                        </div>
                        <div class="col-sm-3">
                            <div class="input-group">
                                <input type="text" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn">
                                    <button type="button" class="btn btn-sm btn-primary"> 搜索</button> </span>
                            </div>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th class="">
                                        <input class="i-checks checkbox check-all" type="checkbox">
                                    </th>
                                    <th class="">用户组</th>
                                    <th class="">描述</th>
                                    <th class="">授权</th>
                                    <th class="">状态</th>
                                    <th class="">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {notempty name="list"}
                                {volist name="list" id="vo"}
                                <tr>
                                    <td><input class="ids i-checks" type="checkbox" name="ids[]" value="{$vo.id}"></td>
                                    <td><a class='editgroup' href="{:\\think\\Url::build('AuthManager/editGroup',['id'=>$vo['id']])}">{$vo.title}</a></td>
                                    <td><span>{$vo['description']|mb_strimwidth=0,60,"...","utf-8"}</span></td>
                                    <td>
                                        <!--<a href="#" >分类授权</a>-->
                                        <a href="{:\\think\\Url::build('AuthManager/access',['group_id'=>$vo['id']])}" >访问授权</a>
                                        <a href="{:\\think\\Url::build('AuthManager/user',['group_id'=>$vo['id']])}" >成员授权</a>
                                    </td>
                                    <td>{$vo.status|change_status=['禁用','正常']}</td>
                                    <td>
                                        <a class="ajax-get confirm" title="编辑" href="{:\\think\\Url::build('setStatus',['value'=>abs($vo['status']-1),'ids'=>$vo['id']])}">{$vo.status|change_status=[1 => '禁用', 0 => '启用']}</a>
                                        <a class="confirm ajax-get" title="删除" href="{:\\think\\Url::build('setStatus',['value'=>-1,'ids'=>$vo['id']])}">删除</a>
                                    </td>
                                </tr>
                                {/volist}
                                {else /}
                            <td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
                            {/notempty}
                            </tbody>
                        </table>
                    </div>
                    <div class="text-center">
                        {notempty name="list"}
                        {$page}
                        {/notempty}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__JS__/plugins/iCheck/icheck.min.js"></script>
<script type="text/javascript">
    $(function () {
        highlight_subnav("{:\\think\\Url::build('auth_manager/index')}");
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green'
        });
        $(".editgroup").on('click', function () {
            var url = $(this).attr('href');
            $.get(url, function (str) {
                if (str.code === 0) {
                    return  alert_msg(str.msg);
                }
                layer.open({
                    type: 1,
                    title: "用户组详情",
                    area: '550px',
                    content: str
                });

            });
            return false;
        });
    });

</script>
{/block}